const path = require('path');

const { merge } = require('webpack-merge');

const baseWebpackConfig = require('./webpack.base.conf.js');

const outputDist = path.join(__dirname, '../dist');

const devWebpackConfig = merge(baseWebpackConfig, {
  mode: 'development',
  
  target: 'web', // 开发时配置页面热更新，认为只有 web 页面需要
  devServer: {
    static: {
      directory: outputDist, // 一般是打包的绝对路径
    },
    historyApiFallback: true,
    host: '0.0.0.0',
    port: 9000,
    open: ['main.html'], // 自动打开哪个页面， 设置 open: true 时，默认打开 index.html
    
    client: {
      overlay: true,
    },
    
    compress: true, // gizp 压缩
    // 启用热更新就不能配置（hot: true）热重载
    liveReload: true, // 配合 target: 'web', 热更新，
  },
  performance: {
    hints: false
  }
})

module.exports = devWebpackConfig;